package com.ktjy.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ktjy.mapper.SysRightMapper;
import com.ktjy.pojo.SysRight;
import com.ktjy.service.ISysRightService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author jjx
 * @since 2025-01-15
 */
@Service
public class SysRightServiceImpl extends ServiceImpl<SysRightMapper, SysRight> implements ISysRightService {
    @Autowired
    SysRightMapper sysRightMapper;

    @Override
    public IPage<SysRight> findPage(SysRight sysRight, Integer pageNo, Integer pageSize) {
        //构造分页条件
        Page page=new Page(pageNo,pageSize);
        //构造过滤条件
        Map<String,Object> param=new HashMap<>();
        param.put("rightText",sysRight.getRightText());
        param.put("rightType",sysRight.getRightType());

        return sysRightMapper.getPage(page,param);
    }

    @Override
    public List<SysRight> findByRoleId(Long roleId) {
        return sysRightMapper.getByRoleId(roleId);
    }
}
